import React from 'react'
import { useNavigate } from 'react-router-dom'

export default function Header() {
  const navi = useNavigate()

  const forward=()=>{
    navi(1)
  }
  const back=()=>{
    navi(-1)
  }
  return (
    <div>
      <h2 style={{display:'inline'}}>Router</h2>
      &nbsp;<button onClick={forward}>前进</button>
      &nbsp;<button onClick={back}>后退</button>
    </div>
  )
}
